package com.fish.anne.model;

import com.fish.anne.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="auto_cat" )
public class AutoCat extends BaseObject implements Serializable {
    private Long catId;
    private String catName;
    private String catPath;
    private String catTitle;
    private Long parentId;
    private Long showOrder;

    @Id   @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getCatId() {
        return this.catId;
    }
    
    public void setCatId(Long catId) {
        this.catId = catId;
    }
    
    @Column(name="cat_name", nullable=false, length=100)
    public String getCatName() {
        return this.catName;
    }
    
    public void setCatName(String catName) {
        this.catName = catName;
    }
    
    @Column(name="cat_path", nullable=false, length=100)
    public String getCatPath() {
        return this.catPath;
    }
    
    public void setCatPath(String catPath) {
        this.catPath = catPath;
    }
    
    @Column(name="cat_title", nullable=false)
    public String getCatTitle() {
        return this.catTitle;
    }
    
    public void setCatTitle(String catTitle) {
        this.catTitle = catTitle;
    }
    
    @Column(name="parent_id", nullable=false)
    public Long getParentId() {
        return this.parentId;
    }
    
    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }
    
    @Column(name="show_order", nullable=false)
    public Long getShowOrder() {
        return this.showOrder;
    }
    
    public void setShowOrder(Long showOrder) {
        this.showOrder = showOrder;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AutoCat pojo = (AutoCat) o;

        if (catName != null ? !catName.equals(pojo.catName) : pojo.catName != null) return false;
        if (catPath != null ? !catPath.equals(pojo.catPath) : pojo.catPath != null) return false;
        if (catTitle != null ? !catTitle.equals(pojo.catTitle) : pojo.catTitle != null) return false;
        if (parentId != null ? !parentId.equals(pojo.parentId) : pojo.parentId != null) return false;
        if (showOrder != null ? !showOrder.equals(pojo.showOrder) : pojo.showOrder != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (catName != null ? catName.hashCode() : 0);
        result = 31 * result + (catPath != null ? catPath.hashCode() : 0);
        result = 31 * result + (catTitle != null ? catTitle.hashCode() : 0);
        result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
        result = 31 * result + (showOrder != null ? showOrder.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("catId").append("='").append(getCatId()).append("', ");
        sb.append("catName").append("='").append(getCatName()).append("', ");
        sb.append("catPath").append("='").append(getCatPath()).append("', ");
        sb.append("catTitle").append("='").append(getCatTitle()).append("', ");
        sb.append("parentId").append("='").append(getParentId()).append("', ");
        sb.append("showOrder").append("='").append(getShowOrder()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
